//
//  ToggleView.swift
//  SwiftUI-CTao
//
//  Created by 涛 on 2019/9/17.
//  Copyright © 2019 涛. All rights reserved.
//

import SwiftUI

struct ToggleView: View {
    @State private var openPush = true

    var body: some View {
        VStack {
            Toggle(isOn: $openPush) {
                Text("是否打开推送")
            }
            .padding()

            if openPush {
                Text("推送打开了")
            } else {
                Text("推送关闭了")
            }
        }
    }
}

struct ToggleView_Previews: PreviewProvider {
    static var previews: some View {
        ToggleView()
    }
}
